<?php 
$show_validator = true;
include TMPL_PATH.'public/header.phtml';
?>
<script type="text/javascript" src="/statics/xheditor/xheditor-zh-cn.min.js"></script>
<div class="subnav">
    <div class="content-menu ib-a blue line-x">
        <a href='<?php echo U('article/index');?>' ><em>文章列表</em></a><span>|</span>
        <a href='javascript:;' class="on"><em><?php if(isset($article)) echo '编辑';else echo'添加';?>文章</em></a></div>
</div>
<script type="text/javascript"> 
<!--
	$(function(){
		$.formValidator.initConfig({formid:"myform",autotip:true,onerror:function(msg,obj){window.top.art.dialog({content:msg,lock:true,width:'200',height:'50'}, function(){this.close();$(obj).focus();})}});
		$("#catid").formValidator({onshow:"请选择分类",onfocus:"请选择分类",oncorrect:"输入正确"}).inputValidator({min:1,onerror:"请选择分类"});
		<?php 
				//if(isset($languageList) && $languageList):
				//	foreach ($languageList as $language_id => $language_name):
			?>
				//	var language_name = "<? echo $language_name; ?>";
				//	var language_id = <?php echo $language_id;?>;
			//		$("#name_"+language_id).formValidator({onshow:"请输入文章"+language_name+"名称",onfocus:"请输入文章"+language_name+"名称",oncorrect:"输入正确"}).inputValidator({min:2,onerror:"请输入文章"+language_name+"名称"});
					$("#name_1").formValidator({onshow:"请输入文章名称",onfocus:"请输入文章名称",oncorrect:"输入正确"}).inputValidator({min:2,onerror:"请输入文章名称"});
		<?php 
			//	endforeach;
		//	endif;
		?>
	});

//-->
</script>
<style type='text/css'>
.pic {
    float: left;
    margin-right: 10px;
    text-align: center;
}
.pic img {
    border: 3px solid #EFEFED;
    cursor: pointer;
}
.pic img.current {
    border: 3px solid #FF6600;
}
</style>
<form name="myform" id="myform" action="__SELF__" method="post" enctype="multipart/form-data">
<div class="pad-10">
<div class="col-tab">
<ul class="tabBut cu-li">
<?php 
$langCount = 0;
if(isset($languageList) && $languageList){
		$langCount = count($languageList);
}
$langCount++;
?>
<li id="tab_setting_1" class="on" onclick="SwapTab('setting','on','',<?php echo $langCount;?>,1);">基本选项</li>
<?php 
	if(isset($languageList) && $languageList):
		$i = 1;
		foreach ($languageList as $language_id => $language_name):
			$i++;
	?>
<li id="tab_setting_<?php echo $i;?>" onclick="SwapTab('setting','on','',<?php echo $langCount;?>,<?php echo $i;?>);"><?php echo $language_name;?></li>
<?php 
		endforeach;
	endif;
	?>
</ul>
</div>
<div id="div_setting_1" class="contentList pad-10">
<table width="100%" class="table_form ">
      <tr>
        <th width="100">文章分类：</th>
        <td>
		<select name="catid" id="catid"><option value='0'>≡ 作为一级分类  ≡</option>
		<?php echo $select_categorys;?>
		</select></td>
      </tr>
      <tr>
        <th>文章图片：</th>
        <td><input type="file" name="upimage" id="upimage" value="" /></td>
      </tr>
      <tr class="hidden">
        <th>页面别名：</th>
        <td><input type="text" name="path_alias" id="path_alias" class="input-text" value="<?php echo isset($article['path_alias']) ? $article['path_alias'] : null;?>"/> <div class="infoShow">地址栏中展示的URL别名</div></td>
      </tr>
			<tr>
      <tr>
        <th>浏览量：</th>
        <td><input type="text" name="visit" id="visit" class="input-text" size="5" value="<?php echo isset($article['visit']) ? $article['visit'] : null;?>"/></td>
      </tr>
			<tr>
        <th>排序：</th>
        <td><input type="text" name="listorder" id="listorder" class="input-text" size="5" value="<?php echo isset($article['listorder']) ? $article['listorder'] : null;?>"/></td>
      </tr>
      <?php if(isset($recommendArray) && $recommendArray):?>
      <tr>
        <th>推荐：</th>
        <td>
	        <?php foreach ($recommendArray as $id => $name):?>
        <input type="checkbox" name="category_article[]" value="<?php echo $id;?>" <?php if(in_array($id, $topIds)) echo 'checked';?>/> <?php echo $name;?> 
	        <?php endforeach;?>
        </td>
      </tr>
      <?php endif;?>
      <tr>
     <th>发布：</th>
      <td>
	  <input type='radio' name='display' value='1' <?php if(!isset($article['display']) || (isset($article['display']) && $article['display']==1))echo 'checked';?>> 是&nbsp;&nbsp;&nbsp;&nbsp;
	  <input type='radio' name='display' value='0' <?php if(isset($article['display']) && $article['display']==0)echo 'checked';?> > 否</td>
    </tr>
	
	<tr>
     <th>url链接：</th>
      <td>
	  <input type="text" name="article_url" class="input-text" style="width:400px;" value="<?php echo isset($article['article_url']) ? $article['article_url'] : null;?>"/>
	  </td>
    </tr>
	
    <tr class="hidden">
        <th>页面模板：</th>
        <td><input type="text" name="template" id="template" class="input-text" value="<?php echo isset($article['template']) ? $article['template'] : null;?>"/> <div class="infoShow">该文章页使用的模板名称，不填为系统默认的模板</div></td>
      </tr>
      <?php if(isset($article['img']) && $article['img']):?>
    <tr>
    <th></th>
      <td><a title="放大" href="javascript:showImage('<?php echo $$article['img'];?>')"><img src="<?php echo $article['img']?>" height="200" /></a></td>
    </tr>
    <?php endif;?>
	</table>
</div>
<?php 
	if(isset($languageList) && $languageList):
		$i = 1;
		foreach ($languageList as $language_id => $language_name):
			$i++;
?>
<div id="div_setting_<?php echo $i;?>" class="contentList pad-10 hidden">
	<table width="100%" class="table_form ">
		<tr>
        <th>文章名称：</th>
        <td><input type="text" name="article[<?php echo $language_id;?>][name]" id="name_<?php echo $language_id;?>" class="input-text" size='60' value="<?php echo isset($article['items'][$language_id]['name']) ? $article['items'][$language_id]['name'] : null;?>"/></td>
      </tr>
			<tr class="hidden">
        <th>文章作者：</th>
        <td><input type="text" name="article[<?php echo $language_id;?>][author]" class="input-text" value="<?php echo isset($article['items'][$language_id]['author']) ? $article['items'][$language_id]['author'] : null;?>"/></td>
      </tr>
      <tr class="hidden">
        <th>文章来源：</th>
        <td><input type="text" name="article[<?php echo $language_id;?>][source]" class="input-text" value="<?php echo isset($article['items'][$language_id]['source']) ? $article['items'][$language_id]['source'] : null;?>"/></td>
      </tr>
		<tr class="hidden">
        <th>摘要：</th>
        <td>
					<textarea name="article[<?php echo $language_id;?>][summary]" style="width:80%;height:46px;"><?php echo isset($article['items'][$language_id]['summary']) ? $article['items'][$language_id]['summary'] : null;?></textarea>
				</td>
      </tr>
			<tr>
        <th>描述：</th>
        <td>
					<textarea name="article[<?php echo $language_id;?>][description]" class="editor"><?php echo isset($article['items'][$language_id]['description']) ? $article['items'][$language_id]['description'] : null;?></textarea>
				</td>
      </tr>
<!--      <tr>
      	<th></th>
      	<td><div class="content_attr"><label><input type="checkbox" checked value="1" name="article[<?php echo $language_id;?>][add_introduce]">是否截取内容</label><input type="text" size="3" value="200" name="article[<?php echo $language_id;?>][introcude_length]" class="input-text">字符至内容摘要
<label><input type="checkbox" checked value="1" name="article[<?php echo $language_id;?>][auto_thumb]">是否获取内容第</label><input type="text" class="input-text" size="2" value="1" name="article[<?php echo $language_id;?>][auto_thumb_no]">张图片作为标题图片
</div></td>
      </tr>-->
      <tr>
	      <th>网页标题：</th>
	      <td><input name='article[<?php echo $language_id;?>][meta_title]' type='text' value='<?php echo isset($article['items'][$language_id]['meta_title']) ? $article['items'][$language_id]['meta_title'] : null;?>' style="width:50%;"><div class="infoShow">针对搜索引擎设置的标题</div></td>
    </tr>
    <tr>
      <th>网页关键词：</th>
      <td><textarea name='article[<?php echo $language_id;?>][meta_keywords]' style="width:50%;height:40px"><?php echo isset($article['items'][$language_id]['meta_keywords']) ? $article['items'][$language_id]['meta_keywords'] : null;?></textarea><div class="infoShow">关键字中间用半角逗号隔开</div></td>
    </tr>
    <tr>
      <th>网页描述：</th>
      <td><textarea name='article[<?php echo $language_id;?>][meta_description]' style="width:50%;height:50px"><?php echo isset($article['items'][$language_id]['meta_description']) ? $article['items'][$language_id]['meta_description'] : null;?></textarea><div class="infoShow">针对搜索引擎设置的网页描述</div></td>
    </tr>
   </table>
</div>
<?php 
		endforeach;
	endif;
	?>
 <div class="bk15"></div>
  <input type="hidden" name="img" value="<?php echo $article['img']?>" />
    <input name="dosubmit" type="submit" class="button" value="提交" class="button">
</div>
</form>
</body>
</html>